﻿
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>字典明细管理</title>
    <#include "../common/link.ftl">
<#--<-- 添加弹出框 &ndash;&gt;-->
    <script>
        $(function () {
           /* $('.btn-delete').click(function () {

                //获取当前点击字典明细的id
                var id = $(this).data('id');

                $.messager.confirm("警告","确认是否删除",function () {

                    //发送 ajax请求
                    $.get('/systemDictionaryItem/delete.do',{id:id},handlerMessage);
                })
            })
*/
            //添加和编辑
            $('.btn-input').click(function () {
                //清空模态框的数据
                $("#editForm input").val('');
                //回显字典目录的数据
                $("#editForm input[name=parentTitle]").val($("#dic .active").html());
                <#--$("#editForm input[name=parentTitle]").val($("a[data-id=${qo.parentId!}]").html());-->
                $("#editForm input[name=parentId]").val(${qo.parentId!});
                //获取事件源
                var json = $(this).data('json');

                if (json){
                    $("#editForm input[name=id]").val(json.id);
                    $("#editForm input[name=title]").val(json.title);
                    $("#editForm input[name=sequence]").val(json.sequence);


                    <#--$("#editForm input[name=parentTitle]").val(json.parentTitle);-->
                    <#--$("#editForm input[name=parentId]").val(${qo.parentId!});-->
                }

                $("#inputModal").modal('show');
            })

            //ajaxSubmit 把表单升级为ajax异步方式,并且马上提交(针对button按钮时用)
            //ajaxForm 把表单升级为ajax异步方式,不会马上提交(针对submit按钮时用)
            $("#editForm").ajaxForm(handlerMessage);

        })
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="systemDictionaryItem"/>
    <#include "../common/menu.ftl">
    <script src="/js/plugins/messager/jquery.bootstrap.min.js"></script>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>字典明细管理</h1>
        </section>
<#--
        <#list systemDictionarys as dic>
    <a href="#" class="list-group-item">${dic.title!}</a>-->
       <#-- </#list>-->
        <div class="row" style="margin:20px">
            <div class="col-xs-3">
                <div class="panel panel-default">
                    <div class="panel-heading">字典目录</div>
                    <div class="panel-body">
                        <div class="list-group" id="dic">
                            <#list dics as dic>
                                <a data-id="${dic.id}" href="/systemDictionaryItem/list.do?parentId=${dic.id}" class="list-group-item">${dic.title!}</a>
                            </#list>
                        </div>
                        <script>
                            //回显目录(高亮效果)
                            $('a[data-id=${qo.parentId!}]').addClass('active')
                        </script>
                    </div>
                </div>
            </div>
            <div class="col-xs-9">
                <section class="content">
                <div class="box">
                    <!--高级查询--->
                    <form class="form-inline" id="searchForm" action="/systemDictionaryItem/list.do" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <input type="hidden" name="parentId" value="${qo.parentId!}">
                        <a href="#" class="btn btn-success btn-input" style="margin: 10px">
                            <span class="glyphicon glyphicon-plus"></span> 添加
                        </a>

                    </form>
                <#--</div>-->

                    <!--编写内容-->
                    <div class="box-body table-responsive no-padding ">
                        <table class="table table-hover table-bordered">
                            <tr>
                                <th>编号</th>
                                <th>标题</th>
                                <th>序号</th>
                                <th>操作</th>
                            </tr>
                        <#list pageResult.list as systemdictionaryitem>
                            <tr>
                                <td>${systemdictionaryitem_index+1}</td>
                                <td>${systemdictionaryitem.title!}</td>
                                <td>${systemdictionaryitem.sequence!}</td>
                                <td>
                                    <a href="#" data-json='${systemdictionaryitem.json!}' class="btn btn-info btn-xs btn-input">
                                        <span class="glyphicon glyphicon-pencil"></span> 编辑
                                    </a>
                                </td>
                            </tr>
                        </#list>
                        </table>
                        <!--分页-->
                    <#include "../common/page.ftl">
                    </div>
            </div>
            </section>
        </div>
    <#include "../common/footer.ftl">
    </div>
            </div>


    <!-- Modal模态框 -->
    <div class="modal fade" id="inputModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">新增/编辑</h4>
                </div>
                <form class="form-horizontal" action="/systemDictionaryItem/saveOrUpdate.do" method="post"
                      id="editForm">
                <div class="modal-body">
                        <input type="hidden" name="id">
                        <div class="form-group" style="margin-top: 10px;">
                            <label for="intro" class="col-sm-3 control-label">字典目录：</label>
                            <div class="col-sm-6">
                                <#-- 目录标题,给用户看 -->
                                 <input type="text" class="form-control" name="parentTitle" readonly >
                                <#-- 目录id,提交到后台,关联用的 -->
                                <input type="hidden" name="parentId">
                            </div>
                        </div>
                        <div class="form-group" style="margin-top: 10px;">
                            <label for="title" class="col-sm-3 control-label">明细标题：</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="title"
                                       placeholder="请输入明细标题">
                            </div>
                        </div>
                        <div class="form-group" style="margin-top: 10px;">
                            <label for="sequence" class="col-sm-3 control-label">明细序号：</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="sequence"
                                       placeholder="请输入明细序号">
                            </div>
                        </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary btn-submit">保存</button>
                    </div>
                </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
